-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new active projects api for export tool #6153
feat: new active projects api for export tool #6153
Conversation
backend/api/projects/resources.py
Outdated
500: | ||
description: Internal Server Error | ||
""" | ||
interval = int(request.args.get("interval", 24)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add validation for the interval
backend/services/project_service.py
Outdated
|
||
@staticmethod | ||
def get_active_projects(interval): | ||
action_date = datetime.now() - timedelta(hours=interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume datetime.now() is in UTC ?
backend/api/projects/resources.py
Outdated
default: Token sessionTokenHere== | ||
- name: interval | ||
in: path | ||
description: Time interval to get active project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time interval in hours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good overall changes added slight comment on end validation ! Cheers
@@ -1197,6 +1197,9 @@ def get(self): | |||
500: | |||
description: Internal Server Error | |||
""" | |||
interval = int(request.args.get("interval", 24)) | |||
interval = request.args.get("interval", "24") | |||
if not interval.isdigit(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 and <=24 restrict user to extract more than 24 hour active projects
result = ( | ||
TaskHistory.query.with_entities(TaskHistory.project_id) | ||
.distinct() | ||
.filter(TaskHistory.action_date >= action_date) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this , test this query with dump of production database , you might need action_date btree timestamp index
@kaditya97 Can you make sure that backend tests are passing ? |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
New endpoint to generate a list of active projects
endpoint: /projects/queries/active/
query parameter:
interval: default to 24 hours
fix Export tool integration: Creating a new endpoint to generate a list of active projects #6144